package com.itheima.thread.api.demo07;

import java.util.concurrent.TimeUnit;

public class MyThread extends Thread {

    @Override
    public void run() {

        for(int x = 0 ; x < 100 ; x++) {

            // 输出线程信息
            System.out.println(Thread.currentThread().getName() + "----" + x);

            //当x的值为20的时候进行线程休眠
            if(x == 20) {
                try {
                    TimeUnit.SECONDS.sleep(30);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

        }

    }

}
